#include<stdio.h>
int m;

int *sort(int n[50])
{
    int boo = 1;
    int q = 100;
    while (boo)
    {
        boo = 0;
        for (int i = 0; i < m-1; i++)
        {
            if (*(n+i)>*(n+i+1))
            {
                int temp;
                temp = *(n+i);
                *(n+i) = *(n+i+1);
                *(n+i+1) = temp;
                boo = 1;
            }
            if (*(n+i) == *(n+i+1))
            {
                *(n+i) = q;
                q+=q;
                boo = 1;
            }
            
        }
    }
    return n;    
}

int main(void)
{
    int n;scanf("%d",&n);
    int *t;

    for (int i = 0; i < n; i++)
    {
        scanf("%d",&m);
        int ints[50];

        for (int j = 0; j < m; j++)
        {
            scanf("%d",&ints[j]);
        }
        t = sort(ints);    
        if (*(t+1)>=100)
        {
            printf("NO\n");
        }
        else printf("%d\n",*(t+1));
    }

}